using AI.Graph;
using UnityEngine;

[CreateNodeMenu ("Condition/Is Time Over")]
public class IsTimeOverCondition : Condition {

    public float time;
    private float timeToReach;
    private bool started;


    protected override void OnStart (AIBehaviour aiBehaviour) {
        started = false;
    }


    protected override bool OnDecide (AIBehaviour aiBehaviour) {
        if (!started) {
            timeToReach = Time.time + time;
        }

        if (Time.time >= timeToReach) {
            started = false;
            return true;
        }

        return false;
    }

}